import type { ReactNode } from "react";
import { languages } from "@/app/i18n/settings";
import { getT } from "@/app/i18n";
import { Header } from "./components/Header";

export async function generateStaticParams() {
  return languages.map((lng: string) => ({ lng }));
}

export async function generateMetadata() {
  const { t } = await getT("translation");
  return {
    title: t("site_name"),
    description: t("site_description"),
  };
}

export default async function LocaleLayout({
  children,
  params,
}: {
  children: ReactNode;
  params: Promise<{ lng: string }>;
}) {
  const { lng } = await params;
  return (
    <html lang={lng}>
      <body className="antialiased min-h-screen bg-white dark:bg-gray-950">
        <Header />
        {children}
      </body>
    </html>
  );
}
